import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_app/app/modules/home/menu.model.dart';
import 'package:flutter_app/app/modules/home/views/menu.view.dart';

import 'package:get/get.dart';

import '../controllers/home_controller.dart';

class HomeView extends GetView<HomeController> {
  const HomeView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    String jsonString = '''[]''';
    List<dynamic> jsonList = jsonDecode(jsonString);
    List<Menu> menuList = jsonList.map((e) => Menu.fromJson(e)).toList();

    return Scaffold(
      appBar: AppBar(
        title: const Text('HomeView'),
        centerTitle: true,
      ),
      body: SingleChildScrollView(
        padding: const EdgeInsets.all(6.0),
        child: Column(
            children: [
              Column(
                children: menuList.map((e) => MenuView(menu: e)).toList(),
              )
            ]
        ),
      )
    );
  }
}
